package com.ad.pet.app.type.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.common.data.utils.glide.GlideUtil;
import com.ad.pet.models.remote.type.FirstCategroy;

import java.util.List;

/**
 * Created by SEELE on 2018/8/2.
 */

public class TypeAdapter extends BaseQuickAdapter<FirstCategroy, BaseViewHolder> {
    public TypeAdapter(@Nullable List<FirstCategroy> data) {
        super(R.layout.item_ali_type_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, FirstCategroy item) {
        ImageView textView = helper.getView(R.id.iv_type);
        View view = helper.getView(R.id.view_line);
        RelativeLayout relativeLayout = helper.getView(R.id.relativeLayout);
//        GlideUtil.load((mContext),item.getFirst_category_pic(),textView);
        GlideUtil.loadDefault(mContext,item.getIcon(),textView);

        if (item.isChose()){
            relativeLayout.setBackgroundColor(mContext.getResources().getColor(R.color.white));
            view.setVisibility(View.VISIBLE);

        }else {
            relativeLayout.setBackgroundColor(mContext.getResources().getColor(R.color.bg_color));
            view.setVisibility(View.INVISIBLE);

        }
    }
}
